﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Xinkui.WebModel.BasicControl;
using Xinkui.DataAccess.AutoGenerator;
using Xinkui.Common;
using CommonFramework.Utility;
using Xinkui.WebModel.Helper;

public partial class UserControl_UserCenter_Seller_UC_Certificate : AccountControl {


    protected void Page_Load(object sender, EventArgs e) {
        if (!IsPostBack) {
            DataBinds();
        }
    }

    protected void DataBinds() {
        int t = 0;
        this.rptCertification.DataSource = Singleton<CompanyInfoDataAccess>.Instance.CompanyCertificateMaintain_ListByCompany(this.BasePage.CurrentLogin.CompanyID, 100, 1, out t);
        this.rptCertification.DataBind();
        if (t <= 0) {
            this.rptCertification.Visible = false;
            this.ltNoData.Visible = true;
        }
    }

    protected void btnDel_Click(object sender, EventArgs e) {
        List<int> chkselect = WebHelper.GetFormValue<string>("chkSelect").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(u => ConvertHelper.ToType<int>(u)).ToList();

        if (chkselect.Count > 0) {
            foreach (var item in chkselect) {
                Singleton<CompanyCertificateMaintainDataAccess>.Instance.CompanyCertificateMaintain_Delete(item);
                Singleton<CompanyCertificateDataAccess>.Instance.CompanyCertificate_Delete(item);
            }
        }
        DataBinds();
        UIHelper.ShowSuucessTips("Record has deleted");
    }
}